<?php
// ------------------------------------------------------------------------- 
//	contact_form
//		Copyright 2005, PichardDesign
// 		http://www.picharddesign.com
// ------------------------------------------------------------------------- 
// ------------------------------------------------------------------------- //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
include "../../mainfile.php";
include XOOPS_ROOT_PATH.'/header.php';
echo "<LINK href=\"contact.css\" rel=\"stylesheet\" type=\"text/css\">\n";

if(isset($_SESSION['success']) && $_SESSION['success'] == 'true'){
	echo"<div style='font-weight:700; font-size:18px; color:#990000; padding:10px;'>Thank you for your comments!</div>";
	echo"<div style='font-weight:600; color:#000000; padding-left:10px; paddin-top:10px;'>".$_SESSION['name']." - ".$_SESSION['email']."</div><P></P>";
	echo"<div style='color:#000000; padding-left:10px; padding-top:0px;'>COMMENTS: ".$_SESSION['comments']."</div><P></P>";
	echo"<div style='color:#000000; font-size:10px; padding-left:10px; padding-top:20px; text-decoration:overline;'>Processed at ".date("g:i a")." on ".date("m/d/y")." from IP address ".$_SERVER['REMOTE_ADDR']."</div><P></P>";
	unset($_SESSION['subject'],$_SESSION['name'],$_SESSION['email'],$_SESSION['comments'],$_SESSION['success']);
}else{
echo("<TABLE width=\"100%\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\" style=\"margin-top:10px; padding-left:5px;\">");
if(isset($_SESSION['message'])){
	echo"<TR><TD style='vertical-align:top; font-weight:600; color:#990000; padding-bottom:15px;' colspan='2'>".$_SESSION['message']."</TD></tr>";
	unset($_SESSION['message']);
}
?>
<TR><TD style='vertical-align:top' width="50%">

<form id="mainForm" action="formaction.php" method="post"
			onsubmit="dumpForm(); return false;">
			<fieldset style=" padding-left:10px; padding-right:10px; padding-bottom:10px;">
				<legend><span style='color:#666666; padding-left:0px; padding-bottom:5px; padding-top:5px; font-weight:600; font-size:17px;'>Contact Us</span>&nbsp;</legend>
				<p>

					<label for="first-name">Subject:</label><br />
					<select name="subject" size="1"  style="margin-bottom:15px;" />
					<?PHP
					$result = $xoopsDB->query( "SELECT * FROM ".$xoopsDB->prefix("contact_form_recipients")." ORDER BY weight ASC" ) ;
					if ( $result ) {
						//$x=0;
						while ( $myrow = $xoopsDB->fetchArray($result) ) {
							if(isset($_SESSION['subject']) && $_SESSION['subject'] == $myrow['ID']){
								echo"<option value='".$myrow['ID']."' selected>".$myrow['subject']."</option>\n";
							}else{
								echo"<option value='".$myrow['ID']."' >".$myrow['subject']."</option>\n";
							}
						//++$i;
						}
					}

					?>
					</select>
					<br / >
					<label for="name">Your Name:</label><br />
					<input type="text" name="name" id="name" size="33" style="margin-bottom:15px;" value='<?PHP if(isset($_SESSION['name'])) { echo $_SESSION['name']; } ?>' />
					<br />
					<label for="email">Your Email:</label><br />

					<input type="text" name="email" id="email" size="33" style="margin-bottom:15px;"value='<?PHP if(isset($_SESSION['email'])){echo $_SESSION['email'];} ?>' />
					<br />
					<label for="age">Comments:</label><br />
					<textarea name="comments" cols="30" rows="3" style=" margin-bottom:8px;"><?PHP if(isset($_SESSION['comments'])){ echo $_SESSION['comments'];} ?></textarea>
					<br />
					<input name="submit" type="submit" value="Send Message" class="inputButton" > &nbsp; &nbsp; <input class="inputButton" name="reset" type="reset" value="Reset"> 

				</p>
			</fieldset>


		</form>




</TD>


<td align="left" width="50%" style='vertical-align:top; padding-left:10px; padding-top:5px;'>
<?PHP
$result = $xoopsDB->query( "SELECT * FROM ".$xoopsDB->prefix('contact_form_contact_info')."" ) ;
 if ( $result ) {
 $myrow = $xoopsDB->fetchArray($result);
 include_once(XOOPS_ROOT_PATH."/class/module.textsanitizer.php");
$myts =& MyTextSanitizer::getInstance();
 
 echo"<div style='font-weight:600; font-size:12px;'>Mailing Address:</div>";
 echo"<div style='padding-left:10px;font-size:12px;'>".$myts->displayTarea($myrow['mailing_addy'])."</div>";
 
 echo"<div style='font-weight:600; padding-top:15px;font-size:12px;'>Voice:</div>";
 echo"<div style='padding-left:10px;font-size:12px;'>".$myts->displayTarea($myrow['voice'])."</div>";
 
 echo"<div style='font-weight:600; padding-top:15px;font-size:12px;'>Fax:</div>";
 echo"<div style='padding-left:10px;font-size:12px;'>".$myts->displayTarea($myrow['fax'])."</div>";
 
 echo"<div style='font-weight:600; padding-top:15px;font-size:12px;'>Office Hours:</div>";
 echo"<div style='padding-left:10px;font-size:12px;'>".$myts->displayTarea($myrow['hours'])."</div>";
 
}

?>
</td>



</TR>
<?PHP

echo"</table>";	
}


include XOOPS_ROOT_PATH."/footer.php";

?>